package svc

import (
	"github.com/zeromicro/go-zero/core/stores/postgres"
	"go-zero-demo/mall/user/rpc/internal/config"
	"go-zero-demo/mall/user/rpc/model"
)

type ServiceContext struct {
	Config       config.Config
	StudentModel model.StudentModel //这个也要写
}

func NewServiceContext(c config.Config) *ServiceContext { //这个是具体的数据库连接，自动生成model
	conn := postgres.New(c.PostgreSQL.Datasource)
	return &ServiceContext{
		Config:       c,
		StudentModel: model.NewStudentModel(conn),
	}
}
